Ext.define('ES.view.archives.ProjectRating',{
	extend:'Ext.container.Container',
	alias:'widget.projectrating',
	requires:['ES.view.components.RatingComp'],
	loadRatingData:function(avgRating, nor,views){
		Ext.ComponentQuery.query('ratingcomp[ESName=pRating]')[0].setRating(avgRating);
		Ext.ComponentQuery.query('component[ESName=uRatingRatio]')[0].update(avgRating + '/5');
		Ext.ComponentQuery.query('component[ESName=ratingViewRatio]')[0].update(nor + '/' + views);
		Ext.ComponentQuery.query('component[ESName=starRate]')[0].update(avgRating);
	},
	initComponent:function(){
		this.items = [
			{
				xtype:'container',
				layout:'hbox',
				items:[
					{
						xtype:'container',
						layout:{
							type:'vbox',
							defaultMargins:{top: 10, right: 0, bottom: 0, left: 10}
						},
						width:'40%',
						items:[
							{
								xtype:'component',
								html:'Rating',
								style:{
									fontWeight:'bold',
									fontSize:12,
									color:'#6DB8E0'
								}
							},
							{
								xtype:'component',
								html:'User Rating',
								style:{
									color:'#6E6E6E'
								}
							},
							{
								xtype:'component',
								ESName:'uRatingRatio',
								html:'4/5',
								style:{
									color:'#6E6E6E'
								}
							},
							{
								xtype:'ratingcomp',
								ESName:'pRating',
								rating:4
							},
							{
								xtype:'component',
								html:'Total Votes received <br/>out of views',
								style:{
									color:'#6E6E6E'
								}
							},
							{
								xtype:'component',
								ESName:'ratingViewRatio',
								html:'1/20',
								style:{
									color:'#6E6E6E'
								}
							}
						]
					},
					{
						xtype:'container',						
						margin:'10 0 0 0',
						width:185,
						height:178,
						layout:{
							type:'hbox',
							align:'middle',
							pack:'center'
						},
						style:{
							backgroundImage:'url(app/assets/bg_rating.png)'
						},	
						items:[
							{
								xtype:'component',
								ESName:'starRate',
								html:'4',
								style:{
									color:'#6E6E6E',
									fontSize:50,
									fontWeight:'bold'
								}
							}
						]
					}					
				]
			}
		]
		this.callParent(arguments);
	}
});
